package project.interactive_face;

import com.github.sarxos.webcam.WebcamResolution;

import javax.swing.*;
import java.awt.*;

public class Interactive_webcam_append implements Interactive_webcam{
    JPanel p1 = new JPanel();   //put_buttons（open/pick）
    JPanel p2 = new JPanel();   //webcam_window
    JDialog jd = new JDialog(); //start_register
    JButton open = new JButton("打开摄像头");
    JButton append = new JButton("添加人脸");

    public void webcamInit(){
        open.setFocusPainted(false);
        append.setFocusPainted(false);
        jd.setTitle("人脸扫描");

        //窗口大小及位置设置
        jd.setLocation(600,200);
        jd.setSize(580,500);
        webcam.setViewSize(WebcamResolution.VGA.getSize());
        jd.setLayout(new BorderLayout());

        //组件安装
        p1.add(open);
        p1.add(append);
        p2.add(wp2);
        p2.setBackground(Color.darkGray);
        jd.add(p2,BorderLayout.CENTER);
        jd.add(p1,BorderLayout.SOUTH);

        //摄像头窗口参数设置
        wp2.setFPSDisplayed(true);
        wp2.setDisplayDebugInfo(true);
        wp2.setMirrored(true);

        //用户交互界面固定参数设置
        jd.setResizable(false);
        jd.setVisible(false);
        wp2.setVisible(false);
        jd.setModal(true);
    }
}
